.ffz-cheer {
	display: inline-block;
	height: 2.8rem;
	line-height: 2.8rem;
	padding-left: 3rem;
	margin: -.5rem .5rem;
	background-position: 0;
	background-repeat: no-repeat;

	&:after {
		font-weight: bold;
		content: attr(data-amount)
	}
}

.ffz--whole-word {
	border: 1px dotted;
}

.ffz-cheer-preview {
	height: 11.2rem;
	width: 11.2rem;
}

.ffz--inline-reasons {
	max-width: 30rem;

	.scrollable-area {
		max-height: min(90vh, max(30rem, 50vh));
	}
}

.ffz--inline-actions {
	vertical-align: middle;
}

.ffz--line-clamp {
	display: -webkit-box;
	-webkit-line-clamp: var(--ffz-lines);
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ffz--rich-header {
	line-height: 1.4;

	margin-left: -0.5rem;
	margin-right: -0.5rem;
}

.ffz--chat-card {
	--ffz-rich-header-outline: var(--color-background-base);
	.ffz--rich-header--background {
		margin: 0; // overflow hidden is in play
	}
}

.ffz--rich-header div span[class="ffz-i-youtube-play"] {
	font-size: 166%;
	line-height: 1em;
	vertical-align: middle;
}

.ffz__tooltip {
	--ffz-rich-header-outline: var(--color-background-tooltip);
	.ffz--rich-header--background {
		margin: -.8rem;
	}
}

.ffz--rich-header--background {
	position: relative;
	overflow: hidden;

	--ffz-rich-header-outline: #000;
	--color-background-base: #000;
	--color-text-base: #efeff1;
	--color-text-alt: #dedee3;
	--color-text-alt-2: #adadb8;

	--color-background-tooltip: var(--color-background-base);
	--color-text-tooltip: var(--color-text-base);
	--color-text-tooltip-alt: var(--color-text-alt);
	--color-text-tooltip-alt-2: var(--color-text-alt-2);

	padding: 1rem;

	margin: -1rem;
	margin-bottom: 0 !important;

	background: var(--color-background-base);

	text-shadow: -1px 1px 2px var(--ffz-rich-header-outline),
		1px 1px 2px var(--ffz-rich-header-outline),
		1px -1px 0 var(--ffz-rich-header-outline),
		-1px -1px 0 var(--ffz-rich-header-outline);

	& > * {
		position: relative;
		z-index: 1;
	}

	.ffz--rich-header__background {
		position: absolute !important;
		z-index: 0 !important;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;

		opacity: 0.5;

		& > img {
			height: 100%;
			width: 100%;
			object-fit: cover;
		}
	}
}

.ffz--rich-player {
	cursor: pointer;

	> * {
		width: 100%;
	}

	.ffz--overlay .ffz--overlay__bit[data-side=center] {
		border-radius: 50%;
		aspect-ratio: 1;

		display: flex;
		align-items: center;
		justify-content: center;
	}
}

.ffz--overlay {
	position: relative;

	& > :not(.ffz--overlay__content) {
		position: absolute;
		z-index: 1;

		background-color: var(--color-background-overlay-alt);
		color: var(--color-text-overlay);

		padding: 0 0.5rem;
		border-radius: 4px;
	}

	.ffz--overlay__content {
		width: 100%;
		height: 100%;
	}

	.ffz--overlay__bit {
		max-width: calc(100% - 1rem);

		&[data-side="top-left"],
		&[data-side="top"],
		&[data-side="top-right"] {
			top: 0.5rem;
		}

		&[data-side="bottom-left"],
		&[data-side="bottom"],
		&[data-side="bottom-right"] {
			bottom: 0.5rem;
		}

		&[data-side="top-left"],
		&[data-side="left"],
		&[data-side="bottom-left"] {
			left: 0.5rem;
		}

		&[data-side="top-right"],
		&[data-side="right"],
		&[data-side="bottom-right"] {
			right: 0.5rem;
		}

		&[data-side="left"], &[data-side="right"] {
			top: 50%;
			transform: translateY(-50%);
		}

		&[data-side="top"], &[data-side="bottom"] {
			left: 50%;
			transform: translateX(-50%);
		}

		&[data-side="center"] {
			top: 50%;
			left: 50%;

			transform: translate(-50%, -50%);
		}

		.ffz--rich-gallery & {
			&[data-side="top-left"],
			&[data-side="top"],
			&[data-side="top-right"] {
				top: 1rem;
			}

			&[data-side="bottom-left"],
			&[data-side="bottom"],
			&[data-side="bottom-right"] {
				bottom: 1rem;
			}
		}
	}

}

.ffz--header-image {
	height: 4.8rem;
	max-width: 25%;

	figure {
		line-height: 4.8rem;
		font-size: 4.8rem;

		&:before {
			margin: 0 !important;
		}
	}

	img {
		object-fit: contain;
		height: 100%;
	}

	&.ffz--header-aspect img {
		object-fit: cover;
		width: 100%;
	}
}

.ffz--compact-header .ffz--header-image {
	height: 2.4rem;

	figure {
		line-height: 2.4rem;
		font-size: 2.4rem;
	}

}

.ffz--rich-gallery, .ffz--compact-header {
	&:not(:first-child) {
		margin-top: 0.5rem;
	}

	&:not(:last-child) {
		margin-bottom: 0.5rem;
	}
}


.ffz--corner-flag {
	position: absolute;
	top: 0;
	right: 0;
	border-color: transparent;
	border-style: solid;
	border-width: 0 3em 3em 0;
	z-index: 100;

	border-right-color: var(--ffz-flag-color);

	&.ffz--corner-flag--left {
		right: unset;
		left: 0;
		border-width: 0 0 3em 3em;

		border-right-color: transparent;
		border-left-color: var(--ffz-flag-color);

		figure {
			right: unset;
			left: -2.75em;
		}
	}

	figure {
		position: absolute;
		top: 0;
		right: -2.75em;
	}
}

.ffz--corner-flag__warn {
	--ffz-flag-color: #f33;
	color: #fff;

	.tw-root--theme-dark & {
		--ffz-flag-color: #900;
		//border-right-color: #900;
	}
}


.ffz-highlight-tags__above {
	display: block;
	margin-top: -0.5rem;
}

.ffz-highlight-tag:not(:last-child) {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}

.ffz-highlight-tag + .ffz-highlight-tag {
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
}

.ffz-highlight-tag {
	margin-right: 2px;
	background: rgba(127,127,127,0.35);
	color: inherit;
}

.ffz--fields {
	display: flex;
	margin-top: -.5rem;
	margin-left: -.5rem;
	flex-flow: row wrap;

	.ffz--field {
		margin-top: 0.5rem;
		margin-left: 0.5rem;
		width: 100%;
	}

	.ffz--field-inline {
		flex: 1;
		width: unset;
		min-width: 140px;
	}

	.ffz--field-icon {
		position: relative;
		padding-left: 2.5rem;
	}
}

.ffz--field__icon {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	left: 0;
}

.ffz--twitter-badge {
	height: 1.2rem;
	width: 1.2rem;
	background: url('//cdn2.frankerfacez.com/static/twitter_sprites.png');
	display: inline-block;
	margin: 2px 0 -1px 0.5rem;

	&.ffz--twitter-badge__verified {
		background-position: 0 -15px;
	}

	&.ffz--twitter-badge__translator {
		background-position: -12px -15px;
	}

	&.ffz--twitter-badge__protected {
		background-position: -24px -15px;
		width: 1.4rem;
	}
}

.ffz--rich-gallery {
	position: relative;
	text-align: center;
	max-height: 350px;

	display: grid;
	grid-column: 1/2;
	grid-template-columns: 1fr 1fr;
	column-gap: 4px;
	border-radius: 4px;
	overflow: hidden;

	&[data-items="1"] {
		display: flex;
		justify-content: center;

		.ffz--gallery-column {
			width: 100%;
		}
	}

	.ffz--gallery-column {
		display: flex;
		flex-direction: column;
		overflow: hidden;
		margin-top: -4px;
		max-height: calc(350px + 4px);

		&:only-child {
			grid-column-start: 1;
			grid-column-end: 3;

			img, video {
				object-fit: contain;
			}

			.ffz-aspect { img, video { object-fit: cover; } }
		}

		> * {
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: center;
			margin: 0;
			padding: 0;
			margin-top: 4px;
		}

		&[data-items="2"] > * {
			min-height: calc(50% - 2px);

			img, video {
				max-height: calc(calc(350px + 4px) / 2);
			}
		}

		&[data-items="1"] > * {
			min-height: 100%;

			img, video {
				max-height: calc(350px + 4px);
			}
		}

		img, video {
			height: 100%;
			width: 100%;
			object-fit: cover;
		}
	}
}


.ffz-shared-chat-badge {
	display: inline-block;
	height: 2.2rem;
	width: 2.2rem;
	margin: 0 .3rem .2rem 0;
	padding: 0.2rem;
	vertical-align: middle;
	border: 2px solid transparent;

	&--active {
		border-color: var(--color-border-brand);
	}

}


.ffz-badge {
	display: inline-block;
	min-width: 1.8rem;
	height: 1.8rem;
	margin: 0 .3rem .2rem 0;
	background-position: center;
	vertical-align: middle;

	&.ffz-no-invert {
		filter:none !important;
	}

	&.ffz-full-size {
		min-width: 1.8rem;
		height: 1.8rem;
		margin: 0 .3rem .2rem 0;
		border-radius: 0;
	}
}


.ffz__tooltip .ffz-i-lock {
	position: absolute;
	bottom: 0; right: 0;
	border-radius: .2rem;
	font-size: 1rem;
	background-color: rgba(0,0,0,0.5);
	color: #fff;
}

.chat-line__message {
	position: relative;
}

.ffz--room-actions {
	.chat-input__buttons-container &.tw-flex-column {
		margin-top: -1rem;
		margin-bottom: -1rem;
	}
}


.ffz--modifier-actions {
	position: absolute;
	top: 0;
	left: 0;
	padding: .5rem 0;
	z-index: 1;

	background: rgba(255,255,255,0.5);

	.dark-theme &,
	.tw-root--theme-dark & {
		background: rgba(0,0,0,0.5);
	}

	.ffz-mod-icon {
		margin: 0 .5rem;
		display: none;
	}


	.chat-line__message:hover & .ffz-hover {
		display: inline-flex;
	}
}

.ffz--keys {
	&[data-ctrl="true"] .ffz-modifier-1,
	&[data-shift="true"] .ffz-modifier-2,
	&[data-shift="true"][data-ctrl="true"] .ffz-modifier-3,
	&[data-alt="true"] .ffz-modifier-4,
	&[data-alt="true"][data-ctrl="true"] .ffz-modifier-5,
	&[data-alt="true"][data-shift="true"] .ffz-modifier-6,
	&[data-alt="true"][data-ctrl="true"][data-shift="true"] .ffz-modifier-7,
	&[data-meta="true"] .ffz-modifier-8,

	&[data-meta="true"][data-ctrl="true"] .ffz-modifier-9,
	&[data-meta="true"][data-shift="true"] .ffz-modifier-10,
	&[data-meta="true"][data-shift="true"][data-ctrl="true"] .ffz-modifier-11,
	&[data-meta="true"][data-alt="true"] .ffz-modifier-12,
	&[data-meta="true"][data-alt="true"][data-ctrl="true"] .ffz-modifier-13,
	&[data-meta="true"][data-alt="true"][data-shift="true"] .ffz-modifier-14,
	&[data-meta="true"][data-alt="true"][data-ctrl="true"][data-shift="true"] .ffz-modifier-15 {

		display: inline-flex;

		&:ffz-hover-action {
			display: inline-block;
		}
	}
}

.ffz--modifier-actions:empty {
	display: none;
}


.ffz--favorite {
	position: absolute;
	bottom: 0; right: 0;

	font-size: 1rem;
	border-radius: .5rem;
	color: gold;

	background-color: rgba(0,0,0,0.5);

	.ffz__tooltip & {
		bottom: .1rem; right: .1rem;
		padding: .2rem 0;
	}
}


.modified-emote {
	~ .chat-line__message--emote {
		position: relative;
		z-index: 1
	}

	.ffz-alt-text {
		display: inline;
		font-size: 1px;
		color: transparent;
	}

	position: relative;
	z-index: 0;

	span {
		position: absolute;
		top: 0; bottom: 0; left: 0; right: 0; // -20px; bottom: -20px; left: -20px; right: -20px;
		margin: auto;
		pointer-events: none;

		img {
			position: absolute;
			pointer-events: none !important;
			margin: 0;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
		}
	}
}
